<template>
  <div class="auBackground">
    <div class="style">
      <el-form
        ref="updateform"
        :model="updateform"
        label-width="150px"
        label-position="right"
      >
        <el-form-item label="全景图">
          <img width="250px" :src="updateform.panorama" alt="" />
        </el-form-item>
        <el-form-item label="普通功率石墨电极">
          <img width="150px" :src="updateform.common_power" alt="" />
        </el-form-item>
        <el-form-item label="高功率石墨电极">
          <img width="150px" :src="updateform.high_power" alt="" />
        </el-form-item>
        <el-form-item label="超高功率石墨电极">
          <img width="150px" :src="updateform.ultra_high_power" alt="" />
        </el-form-item>
        <el-form-item label="石墨粉&石墨块">
          <img width="150px" :src="updateform.toner" alt="" />
        </el-form-item>
      </el-form>
      <div class="addbutton">
        <!-- <el-button @click="Update(updateform)"
          >提交<i class="el-icon-upload el-icon--right"></i
        ></el-button> -->
        <el-button @click="Return()"
          >返回<i class="el-icon-s-home"></i
        ></el-button>
      </div>
    </div>
    <el-dialog
      title="更新logo"
      :visible.sync="logodialog"
      :modal-append-to-body="false"
    >
      <el-upload
        class="upload-demo"
        drag
        action="http://62.234.98.16/fileserver/fileserver/upload"
        multiple
        name="factory_logo"
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip" slot="tip">
          只能上传jpg/png文件，且不超过500kb
        </div>
      </el-upload>
    </el-dialog>
  </div>
</template>

<script>
import { showplatform, updateplatform } from '@/api/platform.js'
export default {
  name: '',

  data () {
    return {
      updateform: {
        panorama: '',
        common_power: '',
        high_power: '',
        ultra_high_power: '',
        toner: ''
      },
      logodialog: false
    }
  },
  created () {
    this.ShowPlatform()
    // console.log()
  },
  methods: {
    ShowPlatform () {
      showplatform().then(res => {
        // console.log(res)
        this.updateform = res.data.data[0]
      })
    },
    Return () {
      this.$router.push({ path: '/platform' })
    },
    Update () {
      updateplatform(this.updateform).then(res => {
        this.$message({
          message: '修改成功',
          type: 'success'
        })
        this.$router.push({
          name: 'platform'
        })
      })
    },
    updateimg () {
      this.logodialog = true
    }
  }
}
</script>
<style scoped>
.auBackground {
  background-color: rgb(255, 255, 255);
  width: 100%;
  min-height: calc(100vh - 50px);
  position: relative;
  overflow: hidden;
  box-shadow: -1px 1px 5px #888888;
  margin: 10px;
}
.addbutton {
  margin-left: 15px;
  margin-top: 20px;
}
.style {
  padding: 1%;
}
</style>
